local getmetatable = getmetatable
local setmetatable = setmetatable
local module = module

module('fit.Counts')
_VERSION='0.2'

local function tally(self, source)
    self.right = self.right + source.right
    self.wrong = self.wrong + source.wrong
    self.ignores = self.ignores + source.ignores
    self.exceptions = self.exceptions + source.exceptions
end

function string(self)
    return self.right .. " right, " ..
           self.wrong .. " wrong, " ..
           self.ignores .. " ignored, " ..
           self.exceptions .. " exceptions"
end

-- Constructor
function __call()
    local counts = {}
    counts.right = 0
    counts.wrong = 0
    counts.ignores = 0
    counts.exceptions = 0

    counts.tally = tally
    counts.string = string

    return counts
end

setmetatable(_M,_M)
